<?php


namespace app\api\controller;


use app\common\controller\Api;
use app\common\model\we\We as WeModel;
use think\Request;

class We extends  Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function getTitles(){
        $res=WeModel::getTitle();
        $this->success("获取关于我们标题列表成功",$res);
    }

    public function getInfo(Request $request){
        $field=$request->param("field")?:"id,we_title,we_published_time,we_description,we_text,we_image";
        $id=$request->param("we_id");
        if(!$id){
            $id=WeModel::where("we_is_show",1)->order("we_sort desc,id asc")->field("id")->find()->toArray()['id'];
        }
        $res=WeModel::getInfoById($id,$field);
        $this->success("获取详情成功",$res);
    }
}